﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media.Imaging;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Com.AMap.Search.API;
using Com.AMap.Maps.Api;
using Com.AMap.Maps.Api.Events;
using Com.AMap.Maps.Api.BaseTypes;
using Com.AMap.Maps.Api.Enums;
using Com.AMap.Maps.Api.Layers;
using Com.AMap.Maps.Api.Overlays;
using Com.AMap.Search.API;
using Com.AMap.Search.API.Options;
using Microsoft.Phone.Controls;
using System.Device.Location;
using System.Collections.ObjectModel;
using Com;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO.IsolatedStorage;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.IO;
using System.Threading;


namespace wpapp
{
    public partial class MainPage : PhoneApplicationPage
    {
        string logid;
        Popup pop;
        Popup popa;
        Popup pop1;
        Popup pop2;
        Popup pop3;
        MMarker mk;
        MLngLat start;
        MLngLat end = new MLngLat(121.50828021, 29.86859951);
        public MainPage()
        {


            InitializeComponent();
            AMapConfig.Key = "ee8dd7493af7b1aaf9e5d59a2c49dfe0";
            InitializeComponent();
            List<zixun> lstzx = new List<zixun>();
            lstzx.Add(new zixun { header = "年中庆 品牌特惠", time = "2013-7-12", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=438" });
            lstzx.Add(new zixun { header = "6月1日-2日 致童年", time = "2013-5-29", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=432" });
            lstzx.Add(new zixun { header = "装修过后需勤保养 家居永葆青春", time = "2013-5-7", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=430" });
            lstzx.Add(new zixun { header = "华康新品入驻，五一隆重开幕", time = "2013-4-30", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=426" });
            lstzx.Add(new zixun { header = "情系雅安 利豪沙发&伊丽丝名床大型义卖赈灾拍卖会", time = "2013-4-25", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=425" });
            lstzx.Add(new zixun { header = "优合美家，北美枫情强劲来袭", time = "2013-4-24", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=424" });
            lstzx.Add(new zixun { header = "华康名家私10周年庆特惠商家大集结", time = "2013-4-24", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=423" });
            lstzx.Add(new zixun { header = "乐百岁婚庆好礼", time = "2012-10-19 ", neirong = "http://www.nbhk.com.cn/new_show.aspx?id=409" });
            // 将 listbox 控件的数据上下文设置为示例数据
            DataContext = App.ViewModel;
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
            this.thelist.DataContext = lstzx;
            this.productlistbox.DataContext = App.products;
        }


        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
         
            this.txbhk.Text="四星级专业家居连锁商场——华康名家私，目前拥有座落于江北区环城北路与人民路交汇处（日湖公园北）的日湖店和海曙区联丰路与机场路交汇处（联丰立交桥西）的联丰店两大专业家居商场，经营面积达8万多平米。自2004年开业以来，华康以其独特的经营理念和营销模式，已经成为家具行业中高端商场的经典代表，宁波消费者追求时尚和品质家居的首选场所。商场集家具、家电为一体，为您搭建起一站式购物平台。商场配备大型中央空调、环保新风系统、多媒体导购指示系统、多部自动扶梯和大型货梯。著名的国际品牌，宜人的购物环境，完善的商业布局，让您感受愉悦的购物之旅！来自国内外数百家知名品牌，上万款或个性鲜明，或时尚前卫，或格调高雅，或品味经典的家具产品和家居用品，带给消费者的将不仅仅是家居商品，更将是一种家居文化，一种生活方式！ 为了能真正帮助消费者实现'整体家居购物'这一目标，华康与苏宁电器在城西首家打造家具家电一站式购物广场，让消费者在买完心怡的家具后直接到苏宁电器去购适合的家电，即省钱又省力。并针对消费者的个性需求推出家具定制馆，提供尺寸可变、板材可选、功能可以增加的家居整体定制及设计服务。 华康名家私秉承'6S'专业服务理念，体验无忧消费保障；透明折扣，差价赔付，设计定制，配送安装，先行赔付，终身维修，旨在进一步规范服务模式和提升华康品质，使之真正成为宁波国际名家居主题购物中心和博览中心，缔造宁波西北面家具产业'第一家居'品牌。";
          
            if (App.logid != null&&  this.popa == null)
            {
                popa = new Popup();

                StackPanel panel = new StackPanel();
                TextBlock logtb = new TextBlock();
                logtb.Text = App.logid.ToString() + "已登录";
                logtb.Height = 35;
                logtb.Width = 200;
                logtb.FontSize = 30;
                SolidColorBrush scb2 = new SolidColorBrush();
                scb2.Color = Colors.Orange;
                logtb.Foreground = scb2;
                HyperlinkButton hyb = new HyperlinkButton();
                hyb.Content = "注销";
               hyb.Margin = new System.Windows.Thickness(-130,0, 0, 0);
               SolidColorBrush scb = new SolidColorBrush();
               scb.Color = Colors.Purple;
                hyb.Foreground = scb;
                hyb.Click += hyb_Click;
                panel.Children.Add(logtb);
                panel.Children.Add(hyb);

                popa.Child = panel;
                popa.IsOpen = true;
            }
            this.ApplicationBar.IsVisible = false;
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }
            if (thepna.SelectedIndex == 2)
            {
                pop = new Popup();

                StackPanel panel = new StackPanel();
                Image imgSearch = new Image();
                imgSearch.Source = new BitmapImage(new Uri("feature.search.png", UriKind.Relative));
                imgSearch.Stretch = Stretch.UniformToFill;

                Button btnSearch = new Button();
                btnSearch.Height = 100;
                btnSearch.Width = 100;
                btnSearch.BorderThickness = new Thickness(0);
                btnSearch.Content = imgSearch;
                btnSearch.Click += new RoutedEventHandler(btnSearch_Click);
                panel.Margin = new Thickness(320, 177, 0, 0);
                panel.Children.Add(btnSearch);

                pop.Child = panel;
                pop.IsOpen = true;
                //  pop1.IsOpen = false;

            }


            else if (thepna.SelectedIndex == 0 && App.logid == null)
            {



                pop = new Popup();

                StackPanel panel = new StackPanel();


                Button btnSearch = new Button();
                btnSearch.Content = "登陆/注册";
                btnSearch.Height = 80;
                btnSearch.Width = 160;
                btnSearch.BorderThickness = new Thickness(1);
                btnSearch.Click += new RoutedEventHandler(btnSearch_Clickone);
                panel.Margin = new Thickness(240,202, 0, 0);
                panel.Children.Add(btnSearch);

                pop.Child = panel;
                pop.IsOpen = true;
                //  pop1.IsOpen = false;

            }
            else
            {
              
                if (pop != null)
                {
                    pop.IsOpen = false;

                }
                if (pop1 != null)
                {

                    pop1.IsOpen = false;
                }
            }
        }

        void hyb_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (MessageBox.Show("确定要注销用户" + App.logid.ToString(), "请确认", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                this.popa.IsOpen = false;
                this.popa = null;
                App.logid = null;
                if (thepna.SelectedIndex == 0 && App.logid == null)
                {


                    pop = new Popup();

                    StackPanel panel = new StackPanel();


                    Button btnSearch = new Button();
                    btnSearch.Content = "登陆/注册";
                    btnSearch.Height = 80;
                    btnSearch.Width = 160;
                    btnSearch.BorderThickness = new Thickness(1);
                    btnSearch.Click += new RoutedEventHandler(btnSearch_Clickone);
                    panel.Margin = new Thickness(240, 202, 0, 0);
                    panel.Children.Add(btnSearch);

                    pop.Child = panel;
                    pop.IsOpen = true;
                    //  pop1.IsOpen = false;
                  
                }
            }
            else { return; }
          
        }

        private void btnSearch_Clickone(object sender, System.Windows.RoutedEventArgs e)
        {
            this.pop.IsOpen = false;
            NavigationService.Navigate(new Uri("/login.xaml", UriKind.Relative));
        }

        private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
        {
            if (pop != null)
            {
                pop.IsOpen = false;

            }
            if (pop1 != null)
            {
                pop1.IsOpen = false;

            }
            if (pop2 != null)
            {
                pop2.IsOpen = false;

            }
            if (pop3 != null)
            {
                pop3.IsOpen = false;

            }
            HyperlinkButton hy = (HyperlinkButton)sender;
            NavigationService.Navigate(new Uri("/Page1.xaml?flstr=" + hy.Tag.ToString(), UriKind.Relative));


        }

        private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (pop != null)
            {
                pop.IsOpen = false;

            }
            if (pop1 != null)
            {
                pop1.IsOpen = false;

            }
            if (pop2 != null)
            {
                pop2.IsOpen = false;

            }
            if (pop3 != null)
            {
                pop3.IsOpen = false;

            }
            Image i = (Image)sender;

            //  MessageBox.Show("asfafas");
            NavigationService.Navigate(new Uri("/Page2.xaml?pdtn=" + i.Tag.ToString(), UriKind.Relative));
        }

        private void thepna_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //if (App.logid != null)
            //{
            //    popa = new Popup();

            //    StackPanel panel = new StackPanel();
            //    TextBlock logtb = new TextBlock();
            //    logtb.Text = App.logid.ToString() + "已登录";
            //    logtb.Height = 35;
            //    logtb.Width = 200;
            //    logtb.FontSize = 30;
            //    SolidColorBrush scb2 = new SolidColorBrush();
            //    scb2.Color = Colors.Orange;
            //    logtb.Foreground = scb2;
            //    HyperlinkButton hyb = new HyperlinkButton();
            //    hyb.Content = "注销";
            //    hyb.Margin = new System.Windows.Thickness(-70, 0, 0, 0);
            //    hyb.Foreground = scb2;
                
            
     
            //    panel.Children.Add(logtb);
            //    panel.Children.Add(hyb);
            //    popa.Child = panel;
            //    popa.IsOpen = true;
            //}
            if (pop2 != null)
            {
                pop2.IsOpen = false;

            }
            if (thepna.SelectedIndex == 4)
            {
                this.ApplicationBar.IsVisible = true;
                pop3 = new Popup();

                StackPanel panel = new StackPanel();
                Image imgSearch = new Image();
                imgSearch.Source = new BitmapImage(new Uri("share.png", UriKind.Relative));
                imgSearch.Stretch = Stretch.Uniform;

                Button btnSearch = new Button();
                btnSearch.Height = 76;
                btnSearch.Width = 76;
                btnSearch.BorderThickness = new Thickness(1);
                btnSearch.Content = imgSearch;
                btnSearch.Click += new RoutedEventHandler(btnSearch_Clickd);
                panel.Margin = new Thickness(323, 198, 0, 0);
                panel.Children.Add(btnSearch);

                pop3.Child = panel;
                pop3.IsOpen = true;
            }
            else
            {
                if (pop3 != null)
                {
                    pop3.IsOpen = false;
                }

                this.ApplicationBar.IsVisible = false;
            }
            if (thepna.SelectedIndex == 2)
            {
                pop = new Popup();

                StackPanel panel = new StackPanel();
                Image imgSearch = new Image();
                imgSearch.Source = new BitmapImage(new Uri("feature.search.png", UriKind.Relative));
                imgSearch.Stretch = Stretch.UniformToFill;

                Button btnSearch = new Button();
                btnSearch.Height = 100;
                btnSearch.Width = 100;
                btnSearch.BorderThickness = new Thickness(0);
                btnSearch.Content = imgSearch;
                btnSearch.Click += new RoutedEventHandler(btnSearch_Click);
                panel.Margin = new Thickness(320, 177, 0, 0);
                panel.Children.Add(btnSearch);

                pop.Child = panel;
                pop.IsOpen = true;
                //  pop1.IsOpen = false;

            }


            else if (thepna.SelectedIndex == 0 && App.logid == null)
            {


                pop = new Popup();

                StackPanel panel = new StackPanel();


                Button btnSearch = new Button();
                btnSearch.Content = "登陆/注册";
                btnSearch.Height = 80;
                btnSearch.Width = 160;
                btnSearch.BorderThickness = new Thickness(1);
                btnSearch.Click += new RoutedEventHandler(btnSearch_Clickone);
                panel.Margin = new Thickness(240, 202, 0, 0);
                panel.Children.Add(btnSearch);

                pop.Child = panel;
                pop.IsOpen = true;
                //  pop1.IsOpen = false;

            }
            else
            {

                if (pop != null)
                {
                    pop.IsOpen = false;

                }
                if (pop1 != null)
                {

                    pop1.IsOpen = false;
                }
            }
        }
        void btnSearch_Clickd(object sender, RoutedEventArgs e)
        {
            MyMap.Children.Clear();
        }
        void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            pop1 = new Popup();

            StackPanel panel = new StackPanel();
            panel.Orientation = System.Windows.Controls.Orientation.Horizontal;
            panel.HorizontalAlignment = HorizontalAlignment.Stretch;
            panel.VerticalAlignment = VerticalAlignment.Top;
            panel.Height = 100;
            panel.Width = 480;
            panel.Margin = new Thickness(0, 50, 0, 0);
            panel.VerticalAlignment = VerticalAlignment.Bottom;
            panel.Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;

            TextBox txbKeyword = new TextBox();
            txbKeyword.Height = 100;
            txbKeyword.Width = 460;
            txbKeyword.FontSize = 40;
            txbKeyword.Text = "请输入要查找的商品名";
            txbKeyword.TextChanged += new TextChangedEventHandler(txbKeyword_TextChanged);
            txbKeyword.KeyDown += txbKeyword_TextChangedn;
            txbKeyword.GotFocus += new RoutedEventHandler(txbKeyword_GotFocus);
            panel.Children.Add(txbKeyword);
            pop1.Child = panel;
            pop1.IsOpen = true;
            pop.IsOpen = false;
        }
        void txbKeyword_TextChanged(object sender, TextChangedEventArgs e)
        {
            //pop1.IsOpen = false;
        }
        void txbKeyword_TextChangedn(object sender, System.Windows.Input.KeyEventArgs e)
        {

            TextBox tbx = (TextBox)sender;

            if (e.Key == Key.Enter)
            {

                if (pop1.IsOpen == true)
                {
                    pop1.IsOpen = false;
                    this.productlistbox.DataContext = App.products.Where(h => h.productname.ToString().IndexOf(tbx.Text.ToString()) != -1);
                }

                this.Focus();
            }
        }
        void txbKeyword_TextChangedd(object sender, System.Windows.Input.KeyEventArgs e)
        {

            TextBox tbx = (TextBox)sender;

            if (e.Key == Key.Enter)
            {
                if (pop2.IsOpen == true)
                {
                    pop2.IsOpen = false;
                    MPOISearch.PoiSearchByCenLngLat(MyMap.Center.LngX, MyMap.Center.LatY, tbx.Text.ToString(), "0574", searchCallBack);
                }

                this.Focus();
            }
        }
        void txbKeyword_GotFocus(object sender, RoutedEventArgs e)
        {
            TextBox tbx = (TextBox)sender;
            tbx.Text = "";
        }
        void map_loaded(object sender, MapEventArgs e)
        {

        }



        private void brow(object sender, EventArgs e)
        {
            MyMap.Center = end;
            MMarker mk;
            MyMap.Children.Add(mk = new MMarker()
            {
                LngLat = MyMap.Center,
                TipFrameworkElement = new MTip() { Title = "华康家私", ContentText = "地 址：海曙区联丰路与机场路交汇处（联丰立交桥西）" }
            });

            //foreach (MMarker mk in Com.AMap.Maps.Api.MMap)
            //{
            //    MessageBox.Show(mk.LngLat.ToString());
            //}
        }
        void amapGeoCoordinateWatcher_PositionChanged(object sender, AGeoPositionChangedEventArgs e)
        {
            if (mk == null)
            {
                mk = new MMarker() { LngLat = e.LngLat };
            }
            if (!MyMap.Children.Contains(mk))
            {
                MyMap.Children.Add(mk);
            }
            else
            {
                mk.LngLat = e.LngLat;
            }
            this.start = e.LngLat;
            MyMap.Center = e.LngLat;
        }

        private void wsch(object sender, EventArgs e)
        {

            AGeoCoordinateWatcher amapGeoCoordinateWatcher = new AGeoCoordinateWatcher();

            amapGeoCoordinateWatcher.PositionChanged += amapGeoCoordinateWatcher_PositionChanged;
            amapGeoCoordinateWatcher.StatusChanged += amapGeoCoordinateWatcher_StatusChanged;
            amapGeoCoordinateWatcher.Start();
        }
        void amapGeoCoordinateWatcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
        {

        }
        private void RouteSearchWithOption()
        {
            MRouteSearchOption m_RouteSearchOption = new MRouteSearchOption();
            m_RouteSearchOption.AvoidanceType = 1; //1:区域避让2：名称避让 3 :表示区域避让和名称避让。 
            m_RouteSearchOption.Ext = "1";/// 当 ext=0 时，表示不返回途经城市；当 ext=1 时，表示返回途经城市列表，城市做排重处理；当 ext=2 时，表示返回途经城市列表，城市不做排重处理。 
            m_RouteSearchOption.Name = ""; //起终点：石碑胡同 避让的一条到路名：
            m_RouteSearchOption.Per = 50;
            //  m_RouteSearchOption.Region = "116.388054,39.90539;116.3881,39.905743";

            m_RouteSearchOption.Config = "R";//路径导航时，config=R ,当查询导航路径距离时，config=CDR
            m_RouteSearchOption.Encode = "GBK";
            m_RouteSearchOption.RouteType = 0;


            m_RouteSearchOption.X1 = start.LngX;
            m_RouteSearchOption.Y1 = start.LatY;
            m_RouteSearchOption.X2 = end.LngX;
            m_RouteSearchOption.Y2 = end.LatY;
            m_RouteSearchOption.Xs = new double[0] { };
            m_RouteSearchOption.Ys = new double[0] { };
            MRouteSearch.RouteSearchWithOption(m_RouteSearchOption, CallBack);
        }

        private void jiache(object sender, EventArgs e)
        {
            RouteSearchWithOption();
        }
        void CallBack(MRouteSearchResult sender)
        {
            if (sender.Erro == null)
            {
                List<MOverlay> list = new List<MOverlay>();
                // MessageBox.Show("通过设置MRouteSearchOption对象属性进行导航路径搜索信息 如下：\nBounds" + sender.Bounds + "Coors：" + sender.Coors + "Count：" + sender.Count.ToString() + "Length：" + sender.Length.ToString() + " Routes.count：" + sender.Routes.Count + " SearchTime：" + sender.SearchTime.ToString());
                for (int i = 0; i < sender.Routes.Count; i++)
                {
                    //string url = "AccessorialInfo：" + sender.Routes[i].AccessorialInfo + "\n" + "Action：" + sender.Routes[i].Action + "\n" + "Coor：" + sender.Routes[i].Coor.ToString() + "\n" + "Direction：" + sender.Routes[i].Direction + "\n" + "DriveTime：" + sender.Routes[i].DriveTime + "\n" + "Form：" + sender.Routes[i].Form + "\n" + "Grade：" + sender.Routes[i].Grade + "\n" + "RoadLength：" + sender.Routes[i].RoadLength + "\n" + "RoadName：" + sender.Routes[i].RoadName + "\n" + "TextInfo：" + sender.Routes[i].TextInfo + "\n";
                    //MessageBox.Show("第" + i + "个路段信息 如下：\n" + url);



                    MLngLatCollection mc = sender.Routes[i].LngLats;//构造经纬度序列集合

                    MPolyline polyline = new MPolyline();
                    polyline.LngLats = mc;//mc为组成线的经纬度坐标串
                    polyline.LineColor = Utilities.HexToColor("#022672");//线的颜色
                    polyline.LineThickness = 6;//线的粗细
                    polyline.CanShowTip = false;
                    MyMap.Children.Add(polyline);//添加到地图           
                    list.Add(polyline);
                }
                MyMap.SetFitview(list);

                if (sender.ViaCities != null)
                {
                    for (int i = 0; i < sender.ViaCities.Count; i++)
                    {
                        string url = "CityEnglishName：" + sender.ViaCities[i].CityEnglishName + "\n" + "CityName：" + sender.ViaCities[i].CityName + "\n" + "Code：" + sender.ViaCities[i].Code + "\n" + "Telnum：" + sender.ViaCities[i].Telnum;
                        MessageBox.Show("途径第" + i + "个城市信息 如下：\n" + url);
                    }
                }
                else
                {
                    return;
                }

            }
            else
            {
                MessageBox.Show(sender.Erro.Message);
            }
        }

        private void poisch(object sender, EventArgs e)
        {
            pop2 = new Popup();

            StackPanel panel = new StackPanel();
            panel.Orientation = System.Windows.Controls.Orientation.Horizontal;
            panel.HorizontalAlignment = HorizontalAlignment.Stretch;
            panel.VerticalAlignment = VerticalAlignment.Top;
            panel.Height = 100;
            panel.Width = 470;
            panel.Margin = new Thickness(0, 50, 0, 0);
            panel.VerticalAlignment = VerticalAlignment.Bottom;
            panel.Background = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;

            TextBox txbKeyword = new TextBox();
            txbKeyword.Height = 100;
            txbKeyword.Width = 460;
            txbKeyword.FontSize = 40;
            txbKeyword.Text = "请输入要找的地点名称";
            txbKeyword.TextChanged += new TextChangedEventHandler(txbKeyword_TextChanged);
            txbKeyword.KeyDown += txbKeyword_TextChangedd;
            txbKeyword.GotFocus += new RoutedEventHandler(txbKeyword_GotFocus);
            panel.Children.Add(txbKeyword);
            pop2.Child = panel;
            pop2.IsOpen = true;


        }
        void searchCallBack(MPOISearchResult sender)
        {
            // MessageBox.Show("关键字查询信息如下：\nCount：" + sender.Count.ToString() + " Record：" + sender.Record.ToString() + " Total：" + sender.Total.ToString() + " POIs.count：" + sender.POIs.Count);
            if (sender.Erro == null)
            {
                List<MOverlay> list = new List<MOverlay>();
                for (int i = 0; i < sender.POIs.Count; i++)
                {
                    MMarker mk;
                    //string url = "Address：" + sender.POIs[i].Address + "\n" + "Code：" + sender.POIs[i].Code + "\n" + "Distance：" + sender.POIs[i].Distance + "\n" + "DriverDistance：" + sender.POIs[i].DriverDistance + "\n" + "Match：" + sender.POIs[i].Match + "\n" + "Name：" + sender.POIs[i].Name + "\n" + "Pguid：" + sender.POIs[i].Pguid + "\n" + "Tel：" + sender.POIs[i].Tel + "\n" + "Type：" + sender.POIs[i].Type + "\n" + "Url：" + sender.POIs[i].Url + "\n" + "X：" + sender.POIs[i].X + "\n" + "Y：" + sender.POIs[i].Y + "\n";
                    //MessageBox.Show("第" + i + "个" + "关键字(肯德基)查询信息 如下：\n" + url);
                    MyMap.Children.Add(mk = new MMarker()
                    {
                        LngLat = new MLngLat(sender.POIs[i].X, sender.POIs[i].Y),
                        TipFrameworkElement = new MTip() { Title = sender.POIs[i].Name, ContentText = sender.POIs[i].Address }
                    });
                    list.Add(mk);
                }

                //根据覆盖物来调整视野
                MyMap.SetFitview(list);
            }
            else
            {
                MessageBox.Show(sender.Erro.Message);
            }
        }
    }
}
